<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var obj = {
            name: "xiaowang",
            age: 20,
            sex: "nan",
        }


        /* 
            for in 是专门用来遍历对象的
        */

        for (var key in obj) {
            console.log(key + ":" + obj[key])
        }
    </script>
</body>

</html>